/**
 * 
 */
package com.cws.business.impl;



import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.activiti.engine.ProcessEngine;
import org.activiti.engine.RepositoryService;
import org.activiti.engine.RuntimeService;
import org.activiti.engine.TaskService;
import org.activiti.engine.repository.Deployment;
import org.activiti.engine.repository.ProcessDefinition;
import org.activiti.engine.runtime.ProcessInstance;
import org.activiti.engine.task.Task;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.cws.business.ILoginBusiness;
import com.cws.dao.QuerySupport;
import com.cws.model.User;
import com.cws.service.BaseService;
import com.cws.util.SpringContextHolder;

/**
 * @author caows
 *
 */
@Service
@Transactional
public class LoginBusinessImpl extends BaseService implements ILoginBusiness {
	
	@Override
	public boolean validateUser(String loginId, String password) {
		Map<String, Object> params = new HashMap<String, Object>();
		params.put(QuerySupport.PARAM_TABLENAME, User.class);
		params.put("_loginId", loginId);
		params.put("_password", password);
		
		return getCount(params) == 1;
	}

	@Override
	public User getUser(String loginId, String password) {
		Map<String, Object> params = new HashMap<String, Object>();
		params.put(QuerySupport.PARAM_TABLENAME, User.class);
		params.put("_loginId", loginId);
		params.put("_password", password);
		
		return getBaseDAO().get(params);
	}
	
	
	
	
	
	
	
	
	
	
	
}
